/*
 * event.hpp
 *
 *  Created on: 03.05.2011
 *      Author: inkooboo
 */

#ifndef _CORE_EVENT_HPP_
# define _CORE_EVENT_HPP_

# include "core/event_types.hpp"

# include <boost/property_tree/ptree.hpp>
# include <boost/uuid/uuid.hpp>

# include <string>
# include <istream>

/** @brief
 * Class describes global event type.
 * For existing event types see event_types.hpp.
 * Events could be passed through network if need in serialized representation.
 * */
class event_t
{
public:

    event_t(event_types_t type, const boost::uuids::uuid &who_is);

    /** @brief Constructs event from stream source. */
    event_t(std::istream &source);

    /** @brief Serialize event into string. */
    std::string serialize() const;

    /** @brief Direct property tree access. */
    boost::property_tree::ptree &params();

    /** @brief Direct event type access. */
    const event_types_t type() const;

    /** @brief Direct uuid access. */
    const boost::uuids::uuid &who_is() const;

private:
    event_t();

    int type_;

    boost::uuids::uuid who_is_;

    boost::property_tree::ptree tree_;
};


#endif /* _CORE_EVENT_HPP_ */
